# ！ /usr/bin/python3
# -*- coding:utf-8 -*-
# @Author:Peng Cao
# @File: 001accss_token.py
# @Software: PyCharm
"""
002获取企业微信服务器的ip段
"""
import requests

corpId = "ww2f6508cb56350a90"  # 企业ID
secret_customer = "0kmu8SIwv29M5Jy8g_fkkzfk77rwE1Q_ia8UCR9_SuQ"  # 应用的凭证密钥

params = {'corpid': corpId, 'corpsecret': secret_customer}
res = requests.get(url="https://qyapi.weixin.qq.com/cgi-bin/gettoken", params=params)
access_token = res.json()["access_token"]
res = requests.get(url=f"https://qyapi.weixin.qq.com/cgi-bin/getcallbackip?access_token={access_token}")
print(res.json())
ip_list = res.json()['ip_list']
print(ip_list)
print(len(ip_list))
